package com.skyline.jfs.base.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.skyline.jfs.base.model.Administrator;

public class AdministratorMapper implements RowMapper<Administrator> {
	private static AdministratorMapper mapper = new AdministratorMapper();

	private final static String ID="id";
	private final static String JOB_NUM="jobNum";
	private final static String FIRST_NAME="firstName";
	private final static String LAST_NAME="lastName";
	private final static String DEPARTMENT="department";
	private final static String POSITION="position";
	private final static String PHONE="phone";
	private final static String EMAIL="email";
	//private final static String PASSWORD="password";
	private final static String EXIST="exist";
	public static AdministratorMapper getMapper() {
		return mapper;
	}

	@Override
	public Administrator mapRow(ResultSet rs, int rowNum) throws SQLException {
		Administrator a = new Administrator();
		a.setDepartment(rs.getString(DEPARTMENT));
		a.setEmail(rs.getString(EMAIL));
		a.setExist(rs.getBoolean(EXIST));
		a.setFirstName(rs.getString(FIRST_NAME));
		a.setId(rs.getInt(ID));
		a.setJobNum(rs.getLong(JOB_NUM));
		a.setLastName(rs.getString(LAST_NAME));
		//a.setPassword(rs.getString(LAST_NAME));
		a.setPhone(rs.getString(PHONE));
		a.setPosition(rs.getString(POSITION));
		return a;
	}

}
